# Contributor: Aaron Hurt <ahurt@ena.com>
# Maintainer:
pkgname=gearmand
pkgver=1.1.21
pkgrel=1
pkgdesc="A distributed job queue"
url="http://gearman.org"
arch="all"
license="BSD-3-Clause"
depends_dev="libevent-dev"
makedepends="
	$depends_dev
	boost-dev
	gperf
	hiredis-dev
	libmemcached-dev
	openssl-dev>3
	sqlite-dev
	util-linux-dev
	"
install="$pkgname.pre-install $pkgname.post-deinstall"
subpackages="$pkgname-doc gearman-dev gearman-libs $pkgname-openrc"
source="https://github.com/gearman/gearmand/releases/download/$pkgver/gearmand-$pkgver.tar.gz
	$pkgname.initd
	$pkgname.confd
	"

	# libtest-cmdline.cc.patch
	# libhashkit-common.h.patch
build() {
	# Configure with only the most commonly used persistence backends.
	# We are explicitly disabling tokyo cabinet, pgsql and mysql to reduce
	# dependencies and overall package size.
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--with-mysql=no \
		--with-postgresql=no \
		--disable-libpq \
		--disable-libtokyocabinet \
		--disable-libdrizzle \
		--enable-ssl \
		--enable-hiredis \
		--enable-jobserver=no
	make V=1
}

package() {
	make DESTDIR="$pkgdir" install

	install -m755 -D "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname
	install -m644 -D "$srcdir"/$pkgname.confd \
		"$pkgdir"/etc/conf.d/$pkgname
}

sha512sums="
d8c6561ddcf7aaf3a861c2a05b014473ff9572fefa9e181ae25b0e88bac8ba09ab4852d98fb0c405b186ae78f6fac22c4248977395162dc41a0e35f53904db49  gearmand-1.1.21.tar.gz
d97dbee95c0b96f0a81e42b730afdb9d129eb83e09be101e1bc2b2cd06a95fe1259265b912bf3850a51c6404e2c5883532a008946dfd46992cb488e1221dae97  gearmand.initd
d27a6acbce663aad91055f96e374ddf12d00a1ccded318693be441b7c4dfde43db73c755002ecfc683a3c1e95139cf378f26e3ab39b5ab6584a40e3991efe245  gearmand.confd
"
